package com.wgt;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by wgt on 2017/5/31.
 */
public class CountChar {


    public static void main(String[] args) {
        String content = "中国aadf的111萨bbb菲的zz萨菲";

        Map<Character,Integer> map = new HashMap<>();

        for (int i=0;i<content.length();i++){
            char c = content.charAt(i);
            Integer value = map.get(c);
            if (value==null){
                value=1;
            }else{
                value=value.intValue()+1;
            }
            map.put(c,value);
        }


        for(Map.Entry<Character,Integer> entry:map.entrySet()){
            System.out.println(entry.getKey()+":"+entry.getValue());
        }
    }
}
